home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS11.ADF / Assembler / cls.ASM < prev    next >
Assembly Source File  |  1986-08-05  |  1KB  |  61 lines

  1. *******************************************************************************
  2. *
  3. *  cls - clear screen cli utility
  4. *
  5. *  author: Tom Caldwell of Sound Design Software
  6. *
  7. *  an assembly example of passing parameters and using the cli output file
  8. *
  9. *******************************************************************************
  10.  
  11.     TTL    cls
  12.  
  13.     section    0
  14.  
  15. EXT_SYS    MACRO
  16.     XREF    _LVO\1
  17.     ENDM
  18.  
  19. SYS    MACRO
  20.     JSR    _LVO\1
  21.     ENDM
  22.  
  23.     EXT_SYS    OpenLibrary
  24.     EXT_SYS    Output
  25.     EXT_SYS    Write
  26.     EXT_SYS    CloseLibrary
  27.  
  28.     XREF    _AbsExecBase
  29.  
  30. MsgLen    EQU    28
  31.  
  32. ; when cli executes a program it passes the pointer to the parameters in A0
  33. ;    and the length in D0
  34.  
  35.     CMP.B    #'?',(A0)    ; question mark
  36.     BEQ.S    QuestMark    ;-yes
  37.     MOVE.L    #ClrScn,D2    ;-no, write out form feed
  38.     MOVEQ    #1,D3        ; length
  39.     BRA.S    Cont
  40. QuestMark
  41.     MOVE.L    #Mesg,D2    ; display message
  42.     MOVEQ    #MsgLen,D3    ; length
  43. Cont
  44.     MOVE.L    _AbsExecBase,A6 ; open dos library
  45.     LEA.L    DosName,A1
  46.     MOVEQ    #0,D0
  47.     SYS    OpenLibrary(A6)
  48.     MOVE.L    D0,A5        ; get output handle
  49.     SYS    Output(A5)
  50.     MOVE.L    D0,D1        ; write to output file
  51.     SYS    Write(A5)
  52.     MOVE.L    A5,A1        ; close dos library
  53.     SYS    CloseLibrary(A6)
  54.     MOVEQ    #0,D0
  55.     RTS
  56. DosName    DC.B    'dos.library',0
  57. ClrScn  DC.B    $C
  58. Mesg    DC.B    'Parameters are not required',$A
  59.  
  60.     end
  61.